#include <iostream>

template<typename T>
class C
{
public:
  typedef T value_type;

  C(T value_)
    : value(value_)
  { }

  T
  getValue()
  {
    return value;
  }

private:
  T value;
};

template<typename T>
class D
{
public:
  D(T value_)
    : c(value_)
  { }

  
  void
  do_something()
      {
	// lesson learned: typename must be specified for nested stuff
	typename C<T>::value_type v = c.getValue();
	std::cout << v << std::endl;
      }

private:
  C<T> c;
};


int main()
{
  D<int> d(5);
  d.do_something();
}
